import { getStorage } from '@/utils/utils';
import request from '@/utils/request';

export async function query(): Promise<responseAllType<{ user_id: number; real_name: string }[]>> {
  return request('auth/getAll');
}

export async function queryCurrent(): Promise<any> {
  const USERNAME = getStorage('antd-pro-authority');
  return request('auth/getUser', {
    method: 'POST',
    data: {
      username: USERNAME ? USERNAME[0] : '',
    },
  });
}

export async function queryNotices(): Promise<any> {
  return request('/api/notices');
}

export async function upload(params): Promise<any> {
  return request('upload', {
    method: 'POST',
    data: params,
    headers: {
      enctype: 'multipart/form-data',
    },
  });
}
